/******************************************************************************\
    Log.h contains functions for log output.
    It's used with acm server. See main.cpp for details.
    Copyright (C) 2008  Victor Vinogradov (fly3333@gmail.com)

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
\******************************************************************************/

#pragma once

#include ".\StdFile.hpp"
#include ".\CriticalSection.hpp"

class cSubLog : public cSubObject
{
private:
	cStdFile LogFile;
	cCriticalSection CriticalSection;

	cSubLog( const cStdFile &log_file );
   ~cSubLog();

	friend class cLog;
};

class cLog : public cObject< cSubLog >
{
public:
   bool Create( const char file_name[], const char *mode );
   void Destroy();
   void WriteV( const char format[], va_list arg_list );
   void Write( const char format[], ... );
   void WriteLineV( const char level[], const char format[], va_list arg_list );
   void WriteLine( const char level[], const char format[], ... );
   void DebugV( const char format[], va_list arg_list );
   void Debug( const char format[], ... );
   void InfoV( const char format[], va_list arg_list );
   void Info( const char format[], ... );
   void NoticeV( const char format[], va_list arg_list );
   void Notice( const char format[], ... );
   void WarningV( const char format[], va_list arg_list );
   void Warning( const char format[], ... );
   void ErrorV( const char format[], va_list arg_list );
   void Error( const char format[], ... );
};
